package nc.task.hdysc;

import java.util.List;
import java.util.Map;

import nc.bs.dao.BaseDAO;
import nc.bs.dao.DAOException;
import nc.hdysc.engine.impl.BaseSyncDataImpl;
import nc.hdysc.engine.itf.ISyncTask;
import nc.hdysc.pub.BaseUtil;
import nc.jdbc.framework.processor.MapListProcessor;
import nc.vo.hdysc.engine.SyncTaskVO;
import nc.vo.hdysc.groupassort.GroupAssortVO;
import nc.vo.hdysc.hotel.HotelVO;

public class HotelTask extends BaseSyncDataImpl<HotelVO> implements ISyncTask<HotelVO> {

	// private SyncTaskVO syncTaskVO;
	public HotelTask() throws DAOException, InstantiationException, IllegalAccessException, ClassNotFoundException {
		super(HotelVO.class);
	}
	public List<HotelVO> getDstDate() throws DAOException {
		List<HotelVO> hotelList = (List<HotelVO>) dDao.retrieveAll(HotelVO.class);
		return hotelList;
	}
	public List<Map<String, Object>> getSourceDate() throws DAOException {
		String sql = "select * from tbdHotelInfo";
		List<Map<String, Object>> hotelList = (List<Map<String, Object>>) sDao
				.executeQuery(sql, new MapListProcessor());
		return hotelList;
	}
	
	public SyncTaskVO getSyncTask() throws DAOException {
		SyncTaskVO syncTask = null;
		BaseDAO dao = new BaseDAO();
		syncTask = (SyncTaskVO) dao.retrieveByPK(SyncTaskVO.class, "0001AA10000000003YTQ");
		return syncTask;
	}
	
	public HotelVO beforeUpdateOrInsert(HotelVO t) {
		return t;
	}

	public int compare(HotelVO sVO, HotelVO dVO) {
		int compare = -1;
		String dCompare = dVO.getHotel_code();
		String sCompare = sVO.getHotel_code();
		if (BaseUtil.equals(dCompare, sCompare)) {
			compare = 1;
		}
		return compare;
	}

}
